Simplify as suggested by Havoc. Just get the last iter and work backward
authorJoe Shaw <joe@ximian.com>
Tue, 22 May 2001 20:38:18 +0000 (20:38 +0000)
committerJoe Shaw <joeshaw@src.gnome.org>
Tue, 22 May 2001 20:38:18 +0000 (20:38 +0000)
2001-05-22  Joe Shaw  <joe@ximian.com>

* gtk/gtktextiter.c (_gtk_text_btree_get_iter_at_last_toggle):
Simplify as suggested by Havoc. Just get the last iter and work
backward to the tag instead of getting a line and working back from
there. Fixes passing in an invalid offset to
iter_init_from_byte_offset().

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtktextiter.c

index 0df2c759485abee2c0e8d3a242c65e4fbb97f04c..103ce5aeb26a7210f60ac8d9fcc558bef68406e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-05-22  Joe Shaw  <joe@ximian.com>
+
+       * gtk/gtktextiter.c (_gtk_text_btree_get_iter_at_last_toggle): 
+       Simplify as suggested by Havoc. Just get the last iter and work
+       backward to the tag instead of getting a line and working back from
+       there. Fixes passing in an invalid offset to
+       iter_init_from_byte_offset().
+
 Tue May 22 16:25:27 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtktreeview*.h: 
index 0df2c759485abee2c0e8d3a242c65e4fbb97f04c..103ce5aeb26a7210f60ac8d9fcc558bef68406e7 100644 (file)
@@ -1,3 +1,11 @@
+2001-05-22  Joe Shaw  <joe@ximian.com>
+
+       * gtk/gtktextiter.c (_gtk_text_btree_get_iter_at_last_toggle): 
+       Simplify as suggested by Havoc. Just get the last iter and work
+       backward to the tag instead of getting a line and working back from
+       there. Fixes passing in an invalid offset to
+       iter_init_from_byte_offset().
+
 Tue May 22 16:25:27 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtktreeview*.h: 
index 0df2c759485abee2c0e8d3a242c65e4fbb97f04c..103ce5aeb26a7210f60ac8d9fcc558bef68406e7 100644 (file)
@@ -1,3 +1,11 @@
+2001-05-22  Joe Shaw  <joe@ximian.com>
+
+       * gtk/gtktextiter.c (_gtk_text_btree_get_iter_at_last_toggle): 
+       Simplify as suggested by Havoc. Just get the last iter and work
+       backward to the tag instead of getting a line and working back from
+       there. Fixes passing in an invalid offset to
+       iter_init_from_byte_offset().
+
 Tue May 22 16:25:27 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtktreeview*.h: 
index 0df2c759485abee2c0e8d3a242c65e4fbb97f04c..103ce5aeb26a7210f60ac8d9fcc558bef68406e7 100644 (file)
@@ -1,3 +1,11 @@
+2001-05-22  Joe Shaw  <joe@ximian.com>
+
+       * gtk/gtktextiter.c (_gtk_text_btree_get_iter_at_last_toggle): 
+       Simplify as suggested by Havoc. Just get the last iter and work
+       backward to the tag instead of getting a line and working back from
+       there. Fixes passing in an invalid offset to
+       iter_init_from_byte_offset().
+
 Tue May 22 16:25:27 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtktreeview*.h: 
index 0df2c759485abee2c0e8d3a242c65e4fbb97f04c..103ce5aeb26a7210f60ac8d9fcc558bef68406e7 100644 (file)
@@ -1,3 +1,11 @@
+2001-05-22  Joe Shaw  <joe@ximian.com>
+
+       * gtk/gtktextiter.c (_gtk_text_btree_get_iter_at_last_toggle): 
+       Simplify as suggested by Havoc. Just get the last iter and work
+       backward to the tag instead of getting a line and working back from
+       there. Fixes passing in an invalid offset to
+       iter_init_from_byte_offset().
+
 Tue May 22 16:25:27 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtktreeview*.h: 
index 0df2c759485abee2c0e8d3a242c65e4fbb97f04c..103ce5aeb26a7210f60ac8d9fcc558bef68406e7 100644 (file)
@@ -1,3 +1,11 @@
+2001-05-22  Joe Shaw  <joe@ximian.com>
+
+       * gtk/gtktextiter.c (_gtk_text_btree_get_iter_at_last_toggle): 
+       Simplify as suggested by Havoc. Just get the last iter and work
+       backward to the tag instead of getting a line and working back from
+       there. Fixes passing in an invalid offset to
+       iter_init_from_byte_offset().
+
 Tue May 22 16:25:27 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtktreeview*.h: 
index 0df2c759485abee2c0e8d3a242c65e4fbb97f04c..103ce5aeb26a7210f60ac8d9fcc558bef68406e7 100644 (file)
@@ -1,3 +1,11 @@
+2001-05-22  Joe Shaw  <joe@ximian.com>
+
+       * gtk/gtktextiter.c (_gtk_text_btree_get_iter_at_last_toggle): 
+       Simplify as suggested by Havoc. Just get the last iter and work
+       backward to the tag instead of getting a line and working back from
+       there. Fixes passing in an invalid offset to
+       iter_init_from_byte_offset().
+
 Tue May 22 16:25:27 2001  Jonathan Blandford  <jrb@redhat.com>
 
        * gtk/gtktreeview*.h: 
index 1d530321461038c1e30b630582b112808d542950..253e104ac5447e03c6c6eae817c3b377b8e0c469 100644 (file)
@@ -4832,27 +4832,14 @@ _gtk_text_btree_get_iter_at_last_toggle  (GtkTextBTree   *tree,
                                          GtkTextIter    *iter,
                                          GtkTextTag     *tag)
 {
-  GtkTextLine *line;
-
   g_return_val_if_fail (iter != NULL, FALSE);
   g_return_val_if_fail (tree != NULL, FALSE);
 
-  line = _gtk_text_btree_last_could_contain_tag (tree, tag);
-
-  if (line == NULL)
-    {
-      /* Set iter to first in tree */
-      _gtk_text_btree_get_iter_at_line_char (tree, iter, 0, 0);
-      check_invariants (iter);
-      return FALSE;
-    }
-  else
-    {
-      iter_init_from_byte_offset (iter, tree, line, -1);
-      gtk_text_iter_backward_to_tag_toggle (iter, tag);
-      check_invariants (iter);
-      return TRUE;
-    }
+  _gtk_text_btree_get_end_iter (tree, iter);
+  gtk_text_iter_backward_to_tag_toggle (iter, tag);
+  check_invariants (iter);
+  
+  return TRUE;
 }
 
 gboolean